Copyright ã1995 by NeXT Computer, Inc.  All Rights Reserved.

NS_DEV_DOCFOR:objc_class:NXCustomImageRep;,NXCustomImageRep

Inherits From:	NXImageRep : Object

Declared In:	appkit/NXCustomImageRep.h

Class Description

An NXCustomImageRep is an object that uses a delegated method to render an image.  When called upon to produce the image, it sends a message to have the method performed.

Like most other kinds of NXImageReps, an NXCustomImageRep is generally used indirectly, through an NXImage object.  To be useful to the NXImage, it must be able to provide some information about the image.  The following methods, inherited from the NXImageRep class, inform the NXCustomImageRep about the size of the image, whether it can be drawn in color, and so on.  Use them to complete the initialization of the object.

setSize:
setNumColors:
setAlpha:
setPixelsHigh:
setPixelsWide:
setBitsPerSample:

Instance Variables

SEL drawMethod;

id drawObject;

drawMethod 	The method that draws the image.

drawObject 	The object that receives messages to perform the drawMethod.

Method Types

Initializing a new NXCustomImageRep
- initDrawMethod:inObject:

Drawing the image	- draw

Archiving	- read:
- write:

Instance Methods

NS_DEV_DOCFOR:objc_method:[NXCustomImageRep-draw];,draw

- (BOOL)draw

Sends a message to have the image drawn.  Returns YES if the message is successfully sent, and NO if not.  The message will not be sent if the intended receiver is nil or it can't respond to the message.

See also:  - drawAt: (NXImageRep), - drawIn: (NXImageRep)

NS_DEV_DOCFOR:objc_method:[NXCustomImageRep-init];,init

Generates an error message.  This method cannot be used to initialize an NXCustomImageRep.  Use initDrawMethod:inObject: instead.

See also:  - initDrawMethod:inObject:

NS_DEV_DOCFOR:objc_method:[NXCustomImageRep-initDrawMethod:inObject:];,initDrawMethod:inObject:

- initDrawMethod:(SEL)aSelector inObject:anObject

Initializes the receiver, a newly allocated NXCustomImageRep instance, so that it delegates responsibility for rendering the image to anObject.  When the NXCustomImageRep receives a draw message, it will in turn send a message to anObject to perform the aSelector method.  The aSelector method should take only one argument, the id of the NXCustomImageRep.  It should draw the image at location (0.0, 0.0) in the current coordinate system.

Returns self.

NS_DEV_DOCFOR:objc_method:[NXCustomImageRep-read:];,read:

- read:(NXTypedStream *)stream

Reads the NXCustomImageRep from the typed stream stream.

See also:  - write:

NS_DEV_DOCFOR:objc_method:[NXCustomImageRep-write:];,write:

- write:(NXTypedStream *)stream

Writes the NXCustomImageRep to the typed stream stream.  The object that's delegated to draw the image is not explicitly written.

See also:  - read: